$(document).ready(function(){
		
	  $(".wrap-sub").hide();
	  
	  //toggle the componenet
	  $(".block-cat h2").click(function()
	  {
		 
		 if($(this).hasClass("current")) {
			$(this).siblings(".wrap-sub").show();
			$(this).removeClass("current");
			$(this).next(".wrap-sub").slideToggle("slow");
		 }else{
			$(this).siblings(".wrap-sub").hide();
			$(this).addClass("current");
			$(this).next(".wrap-sub").slideToggle("slow");
		 }
	  });
	  
	  
	  $("#zoomin").elevateZoom({ 
	  		responsive:true,
			gallery:'thumbs-product', 
			cursor: 'pointer', 
			zoomType: "lens",
			lensShape : "round",
			lensSize : 500,
			galleryActiveClass: 'active', 
			imageCrossfade: false, 
			onZoomedImageLoaded:function(z){
				$(".zoomLens").bind('mousemove',function(e){
					parent=$(e.target.parentNode);
					x = e.pageX;
					y = e.pageY;
					imgx=parent.position().left;
					imgw=parent.outerWidth();
					imgy=parent.position().top;
					imgh=parent.outerHeight();
					if(x>imgx+imgw||x<imgx||y<imgy||y>imgy+imgh){ 
					   //for some reason it needs a delay
					   setTimeout(function(){$(".zoomLens").css('display','none');},1);
					}
		
				}); 
			}
	  });
	  
	  $('.related-product').slick({
		  dots: true,
		  infinite: true,
		  prevArrow: '',
          nextArrow: '', 
		  speed: 300,
		  slidesToShow: 4,
		  slidesToScroll: 4,
		  autoplay: true,
  		  autoplaySpeed: 5000,
		  responsive: [
			{
			  breakpoint: 1024,
			  settings: {
				slidesToShow: 3,
				slidesToScroll: 3,
				infinite: true,
				dots: true
			  }
			},
			{
			  breakpoint: 600,
			  settings: {
				slidesToShow: 2,
				slidesToScroll: 2
			  }
			},
			{
			  breakpoint: 480,
			  settings: {
				slidesToShow: 1,
				slidesToScroll: 1
			  }
			}
			// You can unslick at a given breakpoint now by adding:
			// settings: "unslick"
			// instead of a settings object
		  ]
		});
});

function onBlur(el) {
	if (el.value == '') {
		el.value = el.defaultValue;
	}
}
function onFocus(el) {
	if (el.value == el.defaultValue) {
		el.value = '';
	}
}
